#include <stdio.h>
#include <stdlib.h>
#include <string.h>


void main()
{
	double second = 457422.958801440;
	char data[] = "1975,457422.958801440,7.184707455e-08,1.391773761e-09,-18.000000000,VALID*4f9858ff";
	double week = 0.0;
	double seconds = 0.0;
	double offset = 0.0;
	double offset_std = 0.0;
	double utc_offset = 0.0;
	char status[12] = "0";

	printf("%lf\n", second);		// 457422.958801
	printf("%.8lf\n", second);		// 457422.95880144
	printf("%.9lf\n", second);		// 457422.958801440
	printf("%.10lf\n", second);		// 457422.9588014400

	sscanf(data, "%lf,%lf,%le,%le,%lf,%s", &week, &seconds, &offset, &offset_std, &utc_offset, status);
	printf("%lf, %lf, %le, %le, %lf, %s\n", week, seconds, offset, offset_std, utc_offset, status);	// 1975.000000, 457422.958801, 7.184707e-08, 1.391774e-09, -18.000000, VALID*4f9858ff

	sscanf(data, "%lf,%lf,%le,%le,%lf,%s", &week, &seconds, &offset, &offset_std, &utc_offset, status);
	printf("%lf, %.9lf, %.9le, %.9le, %.9lf, %s\n", week, seconds, offset, offset_std, utc_offset, status);

	#if 1
	/* accuracy(precision) test */
	printf("precision=%lf\n", atof("1.39e-03"));			// 0.001390
	printf("precision=%lf\n", atof("1.39e-04"));			// 0.000139
	printf("precision=%lf\n", atof("1.39e-05"));			// 0.000014
	printf("precision=%lf\n", atof("1.39e-06"));			// 0.000001
	printf("precision=%lf\n", atof("1.39e-07"));			// 0.000000
	printf("precision=%lf\n", atof("1.39e-08"));			// 0.000000
	printf("precision=%lf\n", atof("1.391773761e-03"));		// 0.001392
	printf("precision=%lf\n", atof("1.391773761e-04"));		// 0.000139
	printf("precision=%lf\n", atof("1.391773761e-05"));		// 0.000014
	printf("precision=%lf\n", atof("1.391773761e-06"));		// 0.000001
	printf("precision=%lf\n", atof("1.391773761e-07"));		// 0.000000
	printf("precision=%lf\n", atof("1.391773761e-09"));		// 0.000000
	#endif

	#if 1
	/* accuracy(precision) test */
	printf("precision=%.18lf\n", atof("1.39e-03"));				// 0.001390000000000000
	printf("precision=%.18lf\n", atof("1.39e-04"));				// 0.000139000000000000
	printf("precision=%.18lf\n", atof("1.39e-05"));				// 0.000013900000000000
	printf("precision=%.18lf\n", atof("1.39e-06"));				// 0.000001390000000000
	printf("precision=%.18lf\n", atof("1.39e-07"));				// 0.000000139000000000
	printf("precision=%.18lf\n", atof("1.39e-08"));				// 0.000000013900000000
	printf("precision=%.18lf\n", atof("1.391773761e-03"));		// 0.001391773761000000
	printf("precision=%.18lf\n", atof("1.391773761e-04"));		// 0.000139177376100000
	printf("precision=%.18lf\n", atof("1.391773761e-05"));		// 0.000013917737610000
	printf("precision=%.18lf\n", atof("1.391773761e-06"));		// 0.000001391773761000
	printf("precision=%.18lf\n", atof("1.391773761e-07"));		// 0.000000139177376100
	printf("precision=%.18lf\n", atof("1.391773761e-09"));		// 0.000000001391773761
	#endif

}

